import Vue from 'vue'
import VueRouter from 'vue-router'
import QueryRoomInfo from "../views/QueryRoomInfo";
import AddRoom from "../views/AddRoom";
import UpdateRoom from "../views/UpdateRoom";
import DeleteRoom from "../views/DeleteRoom";
import Index from "../views/Index";
import Login from "../views/Login";

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: '登录',
    show: false,
    component: Login
  },
  {
    path: '/manage',
    name: '房间管理',
    show: true,
    component: Index,
    children:[
      {
        path: '/queryRoomInfo',
        name: '房间列表',
        show: true,
        component: QueryRoomInfo
      },
      {
        path: '/addRoom',
        name: '新增房间',
        show: false,
        component: AddRoom
      },
      {
        path: '/updateRoom',
        name: '更新房间信息',
        show: false,
        component: UpdateRoom
      }
    ]
  },
  {
    path: '/Index',
    name: '导航2',
    component: Index,
    children: [
      {
        path: '/deleteRoom',
        name: '删除房间',
        component: DeleteRoom
      }
    ]
  },
  // {
  //   path: "/test",
  //   name: "Test",
  //   component: () =>
  //       import(/* webpackChunkName: "about" */ "../views/Test.vue"),
  // },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

// const createRouter = () => new VueRouter({
//   routes: commonRoutes,
// })
//
// const router = createRouter()
//
// export function resetRouter() {
//   const newRouter = createRouter()
//   router.matcher = newRouter.matcher
// }

export default router


